package util;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import bean.ConnectMySql;
import bean.Order;
public class productArray {
	public static void getSweet(Order or,int userId){
		Connection con = null;
		PreparedStatement st = null;
		ResultSet rs = null;
		con=ConnectMySql.getConnection();
		try {
			  st=con.prepareStatement("insert into cart values(null,?,?,?)");
	          st.setInt(1,userId);
		      st.setInt(2,or.getDishId());
		      st.setInt(3,or.getQuantity());
		      st.executeUpdate();
		      System.out.println(userId);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		ConnectMySql.closeResultSet(rs);
		ConnectMySql.closeStatement(st);
		ConnectMySql.closeConnection(con);
	}
}
